﻿using System;
using System.Collections.Generic;
using Fuse8.ContentManagementFramework.Domain;

namespace Fuse8.ContentManagementFramework.BizFacade.Services.Contents.Queryable
{
    public static class GenericCmsEntityExtensions
    {
         public static bool PropertyEquals(this GenericCmsEntity entity, string property, object value)
         {
             throw new NotImplementedException("Use this method only in expression");
         }
         public static bool PropertyGreater(this GenericCmsEntity entity, string property, object value)
         {
             throw new NotImplementedException("Use this method only in expression");
         }
         public static bool PropertyGreaterOrEquals(this GenericCmsEntity entity, string property, object value)
         {
             throw new NotImplementedException("Use this method only in expression");
         }
         public static bool PropertyLess(this GenericCmsEntity entity, string property, object value)
         {
             throw new NotImplementedException("Use this method only in expression");
         }
         public static bool PropertyLessOrEquals(this GenericCmsEntity entity, string property, object value)
         {
             throw new NotImplementedException("Use this method only in expression");
         }      
  
        public static bool PropertyIsNull(this GenericCmsEntity entity, string property)
        {
            throw new NotImplementedException("Use this method only in expression");
        }

        public static bool PropertyContains(this GenericCmsEntity entity, string property, string value)
        {
            throw new NotImplementedException("Use this method only in expression");
        }

        public static bool PropertyStartsWith(this GenericCmsEntity entity, string property, string value)
        {
            throw new NotImplementedException("Use this method only in expression");
        }

        public static bool PropertyEndsWith(this GenericCmsEntity entity, string property, string value)
        {
            throw new NotImplementedException("Use this method only in expression");
        }

        public static Dictionary<string, Tuple<string, string, string>> SupportedMehtods
        {
            get
            {
                return new Dictionary<string, Tuple<string, string, string>>()
                           {
                               {"PropertyEquals", Tuple.Create(" = ", "", "")},
                               {"PropertyGreater", Tuple.Create(" > ", "", "")},
                               {"PropertyGreaterOrEquals", Tuple.Create(" >= ", "", "")},
                               {"PropertyLess", Tuple.Create(" < ", "", "")},
                               {"PropertyLessOrEquals", Tuple.Create(" <= ", "", "")},
                               {"PropertyIsNull", Tuple.Create(" is null", "", "")},
                               {"PropertyContains", Tuple.Create(" like ", " N'%' + ", " + N'%' ")},
                               {"PropertyStartsWith", Tuple.Create(" like ", " N'%' + ", "")},
                               {"PropertyEndsWith", Tuple.Create(" like ", "", " + N'%' ")}
                           };
            }
        }
    }
}